<template>
    <div>
        <div class="historyTop">
            <span class="iconfont icon-direction-left left" @click="back()"></span>
            <i>播放历史</i>
            <span class="right" @click="clearhi()">清空</span>
            <!-- <span class="iconfont icon-fenxiang right"></span> -->
        </div>
        <div class="hicontent">
            <div class="songbox" v-for="(item,index) in historyPlay" :key="index" @click="setId(item.id)">
                <div class="text">
                <h5>{{item.name}}</h5>
                <i><span v-for="(i,k) in item.ar" :key="k">{{i.name}} </span> - <span>{{item.al.name}}</span> </i>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
export default {
    props:["historyPlay"],
    data() {
        return {
            isshow:false,
            msg:"成功！！！"
        }
    },
    methods: {
        back(){
                this.$router.go(-1);
            },
            gethistory(){
                console.log(this.historyPlay);
            },
            setId(id){
                this.$emit("get-player-id",id);
            },
            clearhi(){
                // console.log(this.$emit("emptyhistory"));
                this.$emit("emptyhistory");
                // this.historyPlay = []
            }
    },
    mounted() {
        this.gethistory();
    },
}
</script>
<style lang="less">
.historyTop{
    background-color: rgb(245,245,245);
    width: 100%;
    height: 40px;
    display: flex;
    position: fixed;
    line-height: 40px;
    padding: 0 6px;
    // border: 1px solid transparent;
    .left,.right{
        color: black;
        font-size: 20px;
        flex: 0 0 40px;
    }
    .right{
        font-size: 14px !important;
    }
    i{
        font-weight: bold;
        font-size: 18px;
        font-style:normal;
        flex: 1;
    }   
}
.hicontent{
    display: flex;
    flex-direction: column;
    padding-top: 40px;
    .songbox{
        flex: 0 0 60px;
        border-top: 1px solid rgba(158, 156, 156, 0.582);
        // line-height: 30px;
        padding-left: 10px;
        padding-top: 10px;
        box-sizing: border-box;
        .text{
            i{
            font-size: 12px;
            font-style: normal;
            color: rgb(153,153,153);
        }
        }
    }
}
</style>